package com.szt.sy.controller.api.open;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.szt.sy.controller.base.ApiBaseController;
import com.szt.sy.entity.system.ShareFile;
import com.szt.sy.service.system.sharefile.ShareFileService;
import com.szt.sy.vo.rep.base.RepPageVO;

/***
 * 接口-开放-共享文件
 * 
 * @author wwy
 *
 */
@RestController
@RequestMapping("api/open/sharefile")
public class ApiOpenShareFileController extends ApiBaseController {
	
	@Autowired
	private ShareFileService shareFileService;
	
	@PostMapping("page")
	public RepPageVO<List<ShareFile>> shareFilePage(Integer currentPage, Integer pageSize) {
		RepPageVO<List<ShareFile>> repVO = new RepPageVO<>();
		Page<ShareFile> page = new Page<>(currentPage, pageSize);
		EntityWrapper<ShareFile> wrapper = new EntityWrapper<>();
		wrapper.orderBy("id", false);
		page = shareFileService.selectPage(page, wrapper);
		repVO.setCommonSuccess();
		repVO.setData(page.getRecords());
		repVO.setCurrentPage(page.getCurrent());
		repVO.setTotalPage(page.getPages());
		repVO.setTotalResult(page.getTotal());
		return repVO;
	}
	
}
